﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace HotelMgr.Models
{
    public class HotelEntitiesInitializer : DropCreateDatabaseIfModelChanges<HotelEntities>
    {
        protected override void Seed(HotelEntities context)
        {
            var db = new HotelEntities();
            //数据库初始化
            var roomTypeCSR = new RoomType { TypeName = "普通单人房", Price = 30 };
            var roomTypeCDR = new RoomType { TypeName = "普通双人房", Price = 50 };
            var roomTypeSSR = new RoomType { TypeName = "标准单人房", Price = 40 };
            var roomTypeSDR = new RoomType { TypeName = "标准双人房", Price = 70 };
            var roomTypeVip = new RoomType { TypeName = "豪华贵宾房", Price = 100 };
            var roomTypes = new List<RoomType>
            {
                roomTypeCSR,
                roomTypeCDR,
                roomTypeSSR,
                roomTypeSDR,
                roomTypeVip
                
                
            };
            roomTypes.ForEach(r => db.RoomTypes.Add(r));
            var roomStateBookable = new RoomState { Name = "可预定" };
            var roomStateBlocks = new RoomState { Name = "已预定" };
            var roomStateMoveIn = new RoomState { Name = "已入住" };
            var states = new List<RoomState>
            {
                roomStateBookable,
                roomStateBlocks,
                roomStateMoveIn
            };
            states.ForEach(s => db.RoomStates.Add(s));

            var rooms = new List<Room>
            {
                new Room{RoomID = 101, RoomType = roomTypeCSR, RoomPrice = 30, RoomState = roomStateBookable, RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 102, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 103, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 104, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 105, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 106, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateMoveIn,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 107, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 108, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBlocks,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 109, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 110, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 111, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 112, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 113, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 114, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 115, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 116, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 117, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 118, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 119, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 120, RoomType = roomTypeCSR,RoomPrice = 30,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commonsingleroom.gif"},
                new Room{RoomID = 201, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 202, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateMoveIn,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 203, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 204, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 205, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 206, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 207, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 208, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBlocks,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 209, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 210, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 211, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 212, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 213, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 214, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 215, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 216, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 217, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateMoveIn,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 218, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 219, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 220, RoomType = roomTypeCDR,RoomPrice = 50,RoomState = roomStateBookable,RoomUrl = "/Content/Images/commondoubleroom.gif"},
                new Room{RoomID = 301, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 302, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 303, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 304, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBlocks,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 305, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 306, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 307, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 308, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 309, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 310, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 311, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 312, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 313, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBlocks,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 314, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 315, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 316, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 317, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 318, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 319, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 320, RoomType = roomTypeSSR,RoomPrice = 40,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standardsingleroom.gif"},
                new Room{RoomID = 401, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 402, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 403, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 404, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 405, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 406, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 407, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBlocks,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 408, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 409, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateMoveIn,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 410, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 411, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 412, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 413, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 414, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 415, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBlocks,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 416, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 417, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 418, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 419, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 420, RoomType = roomTypeSDR,RoomPrice = 70,RoomState = roomStateBookable,RoomUrl = "/Content/Images/standarddoubleroom.gif"},
                new Room{RoomID = 501, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 502, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 503, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateMoveIn,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 504, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 505, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 506, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 507, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 508, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 509, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBlocks,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 510, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 511, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 512, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 513, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 514, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 515, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 516, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateMoveIn,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 517, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 518, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 519, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateMoveIn,RoomUrl = "/Content/Images/viproom.gif"},
                new Room{RoomID = 520, RoomType = roomTypeVip,RoomPrice = 100,RoomState = roomStateBookable,RoomUrl = "/Content/Images/viproom.gif"},
            };
            rooms.ForEach(t => db.Rooms.Add(t));

            db.SaveChanges();
        }
    }
}